package Server;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.net.ServerSocket;
import java.util.HashMap;

public class ServerData implements Serializable {
	private int                          				serverPort;
	private ServerSocket                  				ss;	
	private HashMap<Integer, ObjectOutputStream>    	userOutMap;
	private static boolean                       		isServerRunning;
	private static int                            		onlineUserNumber;
	
	public int getServerPort() {
		return serverPort;
	}
	public void setServerPort(int serverPort) {
		this.serverPort = serverPort;
	}
	public ServerSocket getSs() {
		return ss;
	}
	public void setSs(ServerSocket ss) {
		this.ss = ss;
	}
	synchronized public HashMap<Integer, ObjectOutputStream> getUserOutMap() {
		return userOutMap;
	}
	synchronized public void setUserOutMap(HashMap<Integer, ObjectOutputStream> userOutMap) {
		this.userOutMap = userOutMap;
	}
	synchronized public boolean isServerRunning() {
		return isServerRunning;
	}
	synchronized public void setServerRunning(boolean isServerRunning) {
		this.isServerRunning = isServerRunning;
	}
	synchronized public static int getOnlineUserNumber() {
		return onlineUserNumber;
	}
	synchronized public static void setOnlineUserNumber(int onlineUserNumber) {
		ServerData.onlineUserNumber = onlineUserNumber;
	}
	public ServerData() {
		configServer();
	}
	private void configServer() {
		this.serverPort = 5555;
		userOutMap = new HashMap<Integer, ObjectOutputStream>();
		isServerRunning = true;
		onlineUserNumber = 0;
		
		try {
			this.ss = new ServerSocket(serverPort);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
